const path = require('path');
const RunPlugin = require('./plugins/run-plugin')
const DonePlugin = require('./plugins/done-plugin')
const AssetsPlugin = require('./plugins/assets-plugin')
console.log(process.cwd(), 'cwd')
module.exports = {
  mode: 'development',
  devtool: false,
  context: process.cwd(),// 上下文目录，./src  .默认代表根目录，默认值就是当前命令执行的时候所在的目录
  entry: './src/index.js',
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'main.js'
  },
  // output: {
  //   path: path.join(__dirname, 'dist'),
  //   filename: '[name].js'
  // },
  plugins: [
    new DonePlugin(),
    new RunPlugin(),
    new AssetsPlugin()
  ],
  resolve: {
    extensions: ['.js', '.json']
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        use: [
          path.resolve(__dirname, 'loaders', 'log1-loader.js'),
          path.resolve(__dirname, 'loaders', 'log2-loader.js')
        ]
      }
    ]
  }

}